﻿#include "MaterialVectorNodeViewModel.h"

#include "MaterialVectorNodeModel.h"

#include "MaterialGraph/Pin/MaterialGraphPinViewModel.h"
#include "MaterialGraph/Pin/MaterialGraphPinModel.h"

#include "MaterialGraph/MaterialGraphViewModel.h"
#include "MaterialGraph/UndoRedo/MaterialEditOperation.h"

void RMaterialVectorNodeViewModel::BindModel(TSharedObjectPtr<RMaterialGraphNodeModel> InModel, TSharedObjectPtr<RMaterialGraphViewModel> InGraph)
{
    Super::BindModel(InModel, InGraph);

    VectorModel = InModel;

    //assgin line index
    //line 0 is the title
    OutputViewModels[0]->SetLineIndex(1);
    OutputViewModels[1]->SetLineIndex(2);
    //line 2 is select 2D or 3D
    InputViewModels[0]->SetLineIndex(3);
    InputViewModels[1]->SetLineIndex(4);
    InputViewModels[2]->SetLineIndex(5);   
}

int64_t RMaterialVectorNodeViewModel::GetLineNum() const
{
    return 6;
}

CString RMaterialVectorNodeViewModel::GetInputPinName(int64_t Index) const
{
    switch (Index)
    {
    case 0:
        return U"X(红色)";
    case 1:
        return U"Y(绿色)";
    case 2:
        return U"Z(蓝色)";
    default:
        assert(false);
        return U"";
    }
}

CString RMaterialVectorNodeViewModel::GetOutputPinName(int64_t Index) const
{
    switch (Index)
    {
    case 0:
        return U"XYZ";
    case 1:
        return U"XY";
    default:
        assert(false);
        return U"";
    }
}
